#ifndef _PILINK_PILOT_H_
#define _PILINK_PILOT_H_

#include "pilink_core.h"

#define PILINK_TYPE_PILOT_HEARTBEAT         (PILINK_CLASS_PILOT + 0x01)
#define PILINK_TYPE_PILOT_IMU               (PILINK_CLASS_PILOT + 0x02)
#define PILINK_TYPE_PILOT_MAG               (PILINK_CLASS_PILOT + 0x03)
#define PILINK_TYPE_PILOT_BARO              (PILINK_CLASS_PILOT + 0x04)
#define PILINK_TYPE_PILOT_GPS               (PILINK_CLASS_PILOT + 0x05)
#define PILINK_TYPE_PILOT_MANUAL            (PILINK_CLASS_PILOT + 0x06)
#define PILINK_TYPE_PILOT_ACTUATOR          (PILINK_CLASS_PILOT + 0x07)

#define PILINK_TYPE_PILOT_ATT               (PILINK_CLASS_PILOT + 0x10)
#define PILINK_TYPE_PILOT_VIO               (PILINK_CLASS_PILOT + 0x11)
#define PILINK_TYPE_PILOT_MOTION            (PILINK_CLASS_PILOT + 0x12)
#define PILINK_TYPE_PILOT_SETPOINT          (PILINK_CLASS_PILOT + 0x13)
#define PILINK_TYPE_PILOT_LOCAL_POS         (PILINK_CLASS_PILOT + 0x14)
#define PILINK_TYPE_PILOT_POS_EST_INFO      (PILINK_CLASS_PILOT + 0x15)

#define PILINK_TYPE_PILOT_MAP_INFO          (PILINK_CLASS_PILOT + 0x20)
#define PILINK_TYPE_PILOT_MAP_POINT         (PILINK_CLASS_PILOT + 0x21)

#define PILINK_TYPE_PILOT_COMMAND           (PILINK_CLASS_PILOT + 0x30)

#define PILINK_TYPE_PILOT_VIO_ID_UNDEFINE   0x10000010
#define PILINK_TYPE_PILOT_VIO_ID_GLSLAM     0x10000011
#define PILINK_TYPE_PILOT_VIO_ID_DFSLAM     0x10000012
#define PILINK_TYPE_PILOT_VIO_ID_VINS       0x10000013
#define PILINK_TYPE_PILOT_VIO_ID_ORBSLAM    0x10000014

#pragma pack(1)

struct pilink_pilot_heartbeat_s{
    unsigned long long timestamp;
};

struct pilink_pilot_imu_s{
    unsigned long long timestamp;
    float acc[3];
    float gyro[3];
};

struct pilink_pilot_manual_s{
    unsigned long long timestamp;
    float channel[16];
};

struct pilink_pilot_vio_s{
    unsigned long long timestamp;
    int   id;
    float vel[3];
    float pos[3];
    float q[4];
    float accuracy[3];
};

struct pilink_pilot_att_s{
    unsigned long long timestamp;
    float q[4];
    float rate[3];
};

struct pilink_pilot_local_pos_s{
    unsigned long long timestamp;
    float pos[3];
    float vel[3];
    float acc[3];
};

struct pilink_pilot_setpoint_s{
    unsigned long long timestamp;
    float pos[3];
    float vel[3];
    float acc[3];
    float qatt[4];
    float rate[3];
    float force[3];
    float torque[3];
};

struct pilink_pilot_actuator_s{
    unsigned long long timestamp;
    float channel[8];
};

struct pilink_pilot_mag_s{
    unsigned long long timestamp;
    float data[3];
};

struct pilink_pilot_baro_s{
    unsigned long long timestamp;
    float pressure;
    float altitude;
    float temperature;
};

struct pilink_pilot_pos_estimator_s{
    unsigned long long timestamp;
    float pos_gps[3];
	float vel_gps[3];
	float pos_vio[3];
	float vel_vio[3];
	float pos_est[3];
	float vel_est[3];
	float acc[3];
	float acc_bias[3];
};

struct pilink_pilot_map_info_s{
    unsigned long long timestamp;
    int   size_x;
    int   size_y;
    int   size_z;

    float resolution;
    float start_x;
    float start_y;
    float start_z;

    int   data_num;
    int   current_frame;
};

struct pilink_pilot_map_point_s{
    unsigned long long timestamp;
    int   pos_x;
    int   pos_y;
    int   pos_z;

    int   update_time;
    float value;
};

enum pilink_commmand_e{
    PILINK_COMMAND_ARM     = 0x00001000,
    PILINK_COMMAND_DISARM  = 0x00001001,
    PILINK_COMMAND_TAKEOFF = 0x00001002,
    PILINK_COMMAND_RTH     = 0x00001003,
    PILINK_COMMAND_LAND    = 0x00001004,
    PILINK_COMMAND_CHMOD   = 0x00001005,
	PILINK_COMMAND_AUTO    = 0x00001006,
	PILINK_COMMAND_POSCTL  = 0x00001007,
	PILINK_COMMAND_VELCTL  = 0x00001008,
	PILINK_COMMAND_EMLAND  = 0x00001009,
    PILINK_COMMAND_REBOOT  = 0x00002001,
};

struct pilink_pilot_command_s{
    unsigned long long timestamp;
    unsigned int  cmd;
    unsigned int  param[6];
};

#pragma pack()


#endif
